__author__ ="jys";
import re;

'''
python 练习
'''

#函数
def fun_01():
    print("HELLO WORLD");

#fun_01();
#位置参数
def fun_02(name,age=18):
    print(name, age);

#可变参数
def fun_03(*args):
    print(args);

#可变关键字参数
def fun_04(**kwargs):
    print(kwargs);

#命名关键字参数
def fun_05(name, *, age):
    print(name, age);

#函数单一返回值
def fun_06():
    return "asjdif";

#函数多返回值
def fun_07():
    return "asdfsac",66,True;

#空函数
def fun_08():
    pass;

#递归函数:自己调用自己，设置跳出循环的条件
def fun_09(num):
    if num == 1:
        return num;
    return num * fun_09(num - 1);

if __name__=='__main__':
    fun_01();

if __name__=='__main__':
    fun_02("sg", 18);

if __name__ == '__main__':
    fun_03("sg", 18, None, 24.24);

if __name__ == '__main__':
    fun_04(name="sg",age=29);

if __name__ == '__main__':
    fun_05("sg", age=26);

if __name__ == '__main__':
    f = fun_06();
    print(f);

if __name__ == '__main__':
    f = fun_07();
    print(f);

if __name__ == '__main__':
    fun_08();

if __name__ == '__main__':
    print(fun_09(10));

#类
class User(object):
    def __init__(self, user_name, password, email):
        self.user_name = user_name;
        self.password = password;
        self.email = email;

    def get_user_name(self):
        return  self.user_name;

    def set_user_name(self,user_name):
        self.user_name = user_name;

    def login(self, user_name, password):
        pass;

if __name__ == '__main__':
    user = User("sg", "123456", "sg@163.com");
    print(user.user_name);
    print(user.__dict__);
